using System;
using System.Collections.Generic;
using System.Text;
using Barrage.Items._2D;
using Barrage.Meshes.Text;
using Barrage.Scenes;
using Barrage.Global;
using SlimDX;

namespace Barrage.Render
{
    class DebugRenderProcess:RenderProcess
    {
        static DebugRenderProcess instance = null;
        public static DebugRenderProcess Instance { get { if (instance == null) instance = new DebugRenderProcess(); return instance; } }

        BasicText text;
        Scene2D scene;
        protected DebugRenderProcess()
        {
            finalRenderPass.MustClear = false;
            scene = new Scene2D();
            text = new BasicText(BitmapFontManager.DefaultFont);
            text.Motion.Translation = new Vector3(-Engine.DefaultRenderTargetDescription.Width / 2f, -Engine.DefaultRenderTargetDescription.Height / 2f + 20,0);
            text.TextMesh.DrawProperties = new TextDrawProperties(0.75f, Vector2.Zero);
            scene.Add(text);
            addSource(scene);
        }

        public override void Render()
        {
            text.Text = String.Format("Render calls: {0}\tObjects culled: {1}", RenderStats.RenderCalls, RenderStats.CulledObjects);
            scene.Update();
            base.Render();
        }
    }
}
